import mmap
import contextlib
import time
import random

i = 0

# node2
while True:
    with open('node1.dat', 'r') as fin:
        with contextlib.closing(mmap.mmap(fin.fileno(), 0, access=mmap.ACCESS_READ)) as m:
            s = m.read(1024)
            s = s.decode()
            print(s)
            i += 1
            print("node2: I'm fine, thx!" + str(i))
            time.sleep(1)


